//
//  ZHMainDetailTitleHeader.m
//  ZHS_UCDemo
//
//  Created by Emrys on 2016/11/23.
//  Copyright © 2016年 Emrys. All rights reserved.
//

#import "ZHMainDetailTitleHeader.h"

#import "ZHLabel.h"

static const CGFloat kZHMainDetailTitleHeaderX = 0;
static const CGFloat kZHMainDetailTitleHeaderY = 0;
static const CGFloat kZHMainDetailTitleHeaderHeight = 44;

@interface ZHMainDetailTitleHeader ()

@property(nonatomic, strong) ZHLabel *titleLabel;

@end

@implementation ZHMainDetailTitleHeader

+ (instancetype)mainDetailTitleHeader {
    
    ZHMainDetailTitleHeader *mainDetailTitleHeader
    = [[self alloc]
       initWithFrame:CGRectMake(kZHMainDetailTitleHeaderX
                                ,kZHMainDetailTitleHeaderY
                                ,kScreenWidth
                                ,kZHMainDetailTitleHeaderHeight)];
    
    [mainDetailTitleHeader.contentView addSubview:mainDetailTitleHeader.titleLabel];
    
    mainDetailTitleHeader.titleLabel.text = @"test";
    [mainDetailTitleHeader.titleLabel sizeToFit];
    
    return mainDetailTitleHeader;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.titleLabel.center = self.contentView.center;
}

#pragma mark - 懒加载
- (ZHLabel *)titleLabel {
    if (nil == _titleLabel) {
        _titleLabel = [[ZHLabel alloc] initWithFrame:CGRectZero];
        _titleLabel.center = self.contentView.center;
    }
    return _titleLabel;
}
@end
